<?php
/**
 * A version of Config that uses an XML file.
 */
class Config_Xml extends Config_File {
	/**
	 * Constructor.
	 *
	 * @param string $filename
	 */
    public function __construct($filename, $readonly = false) {
		parent::__construct($filename);
		$config = simplexml_load_file($filename);
		foreach($config as $section) {
		    if(!is_array($this->config[(string)$section->attributes()->name])) {
		        $this->config[(string)$section->attributes()->name] = array();
		    }
		    foreach($section as $k => $c) {
		        $this->config[(string)$section->attributes()->name][$k] = (string)$c;
		    }
		}
		$this->readonly = $readonly;
	}
}
?>